<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['系统基础管理','库存管理']" icon="fa fa-list" class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
		</sa-big-breadcrumbs>
	</div>

	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span>
					<h2>库存管理</h2>
				</header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">设备状态</span>
									<select name="" class="top_module_select" [(ngModel)]="table.status">
										<option *ngFor="let item of deviceStatusList" [value]='item.value'>
											{{item.label}}</option>
									</select>
								</div>

								<div class="top_module top_module_box">
									<span class="module_text">产品编码</span>
									<input type="text" class="module_inp top_module_select" [(ngModel)]="table.productNo" placeholder="输入产品编码" />
								</div>

								<div class="top_module top_module_box">
									<span class="module_text">设备ID</span>
									<input type="text" class="module_inp top_module_select" [(ngModel)]="table.deviceId" placeholder="输入设备ID" />
								</div>

								<div class="top_module top_module_box">
									<span class="module_text">ICCID</span>
									<input type="text" class="module_inp top_module_select" [(ngModel)]="table.iccid" placeholder="输入ICCID" />
								</div>

								<div class="top_module top_module_box">
									<span class="module_text">外箱编码</span>
									<input type="text" class="module_inp top_module_select" [(ngModel)]="table.caseNo" placeholder="输入外箱编码" style="width: 200px;" />
								</div>

								<div class="top_module top_module_box">
									<span class="top_module_label module_text">时间类型</span>
									<select name="" class="top_module_select" [(ngModel)]="table.dataType">
										<option value='1'>生产时间</option>
										<option value='2'>发货时间</option>
										<option value='3'>录入时间</option>
										<option value='4'>更新时间</option>
									</select>
								</div>

								<div class="selectDate top_module">
									<span class="top_module_label module_text" style="vertical-align: top;">时间</span>
									<div class="input-daterange input-group s_selected_time_box s_hover_box" style="border-radius: 0 4px 4px 0;">
										<input type="text" [(ngModel)]='table.startTime' class="form-control s_selected_time" id="datetimepicker1" autocomplete="off" placeholder="选择开始时间" />
										<span class="s_selected_time_spe">至</span>
										<input type="text" [(ngModel)]='table.endTime' class="form-control s_selected_time" id="datetimepicker2" autocomplete="off" placeholder="选择结束时间" />
										<div class="s_del_icon" (click)='del_date_p()'>x</div>
									</div>
								</div>

								<!--<div class="selectDate top_module">
									<span class="top_module_label module_text" style="vertical-align: top;">发货时间</span>
									<div class="input-daterange input-group s_selected_time_box s_hover_box" style="border-radius: 0 4px 4px 0;">
										<input type="text" [(ngModel)]='table.startTimeForSend' class="form-control s_selected_time" id="datetimepicker3"  autocomplete="off" placeholder="选择开始时间"/>
										<span class="s_selected_time_spe">至</span>
										<input type="text" [(ngModel)]='table.endTimeForSend' class="form-control s_selected_time" id="datetimepicker4"  autocomplete="off" placeholder="选择结束时间"/>
										<div class="s_del_icon" (click)='del_date_s()'>x</div>
									</div>
								</div>-->
								<button class="btn btn-primary" (click)="table_search()">查询</button>
								<button class="btn btn-primary" (click)="addRowDatas()">新增</button>
								<button type="button" class="btn btn-primary" (click)="showImportModal(weightModal)">导入</button>
								<button type="button" class="btn btn-primary" (click)="exportData()">导出</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="table.searchKey" (change)="table_search()" class="search-input" placeholder="关键字...">
								<span class="top-search-box">
									<button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
								</span>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>生产时间</th>
										<th>设备状态</th>
										<th>产品编号</th>
										<th>设备ID</th>
										<th>外箱编码</th>
										<th>ICCID</th>
										<th>产品型号</th>
										<th>通道信息</th>
										<th>是否带电池</th>
										<th>GPS供应商</th>
										<th>SIM供应商</th>
										<th>MES编号</th>
										<th>主机检验结果</th>
										<th>发货时间</th>
										<th>发货地址</th>
										<th>公司名称</th>
										<th>硬件版本</th>
										<th>软件版本</th>
										<th>BootLoader版本</th>
										<th>主机版本号</th>
										<th>备注</th>
										<th>入库人员</th>
										<th>出库人员</th>
										<th>录入时间</th>
										<th>更新时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData">
										<td>{{row.productTime}}</td>
										<td>
											<span *ngIf="!(row.status == 0 || row.status == 1)">全部</span>
											<span *ngIf="row.status == 0">库存</span>
											<span *ngIf="row.status == 1" class="green">已发货</span>
										</td>
										<td>{{row.productNo}}</td>
										<td>{{row.deviceId}}</td>
										<td>{{row.caseNo || ''}}</td>
										<!-- <td>{{row.iccid}}</td> -->
										<td>
											<div class="iccid-box">
												<span>{{row.iccid}}</span>
												<span class="icon logoff" *ngIf="row.cardStatusCode === 0" title="注销"></span>
												<span class="icon halt" *ngIf="row.cardStatusCode === 1" title="停机保号"></span>
											</div>
										</td>
										<td>{{row.productType}}</td>
										<td>{{row.productChannel}}</td>
										<td>
											<span *ngIf="row.hasLIB == '1'">是</span>
											<span *ngIf="row.hasLIB == '0'">否</span>
										</td>
										<td>{{row.gpsProducer}}</td>
										<td>{{row.simProducer}}</td>
										<td>{{row.mesNumber}}</td>
										<td>
											<span *ngIf="row.resultStatus == '1'">合格</span>
											<span *ngIf="row.resultStatus == '2'">不合格</span>
										</td>
										<td>{{row.sendTime}}</td>
										<td>{{row.sendAddress}}</td>
										<td>{{row.sendCompany}}</td>
										<td>{{row.hwVersion}}</td>
										<td>{{row.swVersion}}</td>
										<td>{{row.blVersion}}</td>
										<td>{{row.mbVersion}}</td>
										<td>{{row.remake}}</td>
										<td>{{row.inUser}}</td>
										<td>{{row.outUser}}</td>
										<td>{{row.creatTime}}</td>
										<td>{{row.updateTime}}</td>
										<td>
											<button type="button" *ngIf="limitsEdit" (click)="editRowEvent(row)">编辑</button>
											<button type="button" *ngIf="limitsDelete" (click)="delDeviceStore(row)">删除</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount" [rows]="pageSize" [currentPage]="curPage - 1" (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
</div>

<!-- 导入弹框 -->
<div bsModal #weightModal="bs-modal" class="modal fade" id="weightModal" tabindex="-1" role="dialog" aria-labelledby="weightModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header" style="position: relative;">
				<button type="button" class="close" (click)="cancelUp(weightModal)" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h4 class="modal-title">上传Excel文件</h4>
				<div class="importBtn">
					<button type="button" class="btn btn-primary" (click)="load_module()">下载模板</button>
				</div>
			</div>
			<div class="modal-body">

				<div class="row">
					<form class="form form-inline " role="form">
						<div class="row">
							<div class="col-sm-10" style="padding: 0;">
								<div class="clearfix module_line">
									<button type="button" class="btn btn-primary" style="width: 120px;margin-bottom: 12px;">上传模板文件
										<input type="file" class="up" (change)="fileChange($event.target.files)" name="fileToUpload" (click)='clearFile()' [(ngModel)]='fileUp' />
									</button>
									<br />
									<span class="row note">注：请先下载模板，采用模板编辑文件后上传 (格式excel)</span>
								</div>
							</div>
						</div>
						<div *ngIf="fileToUpload">
							<label class="control-label col-sm-1"></label>
							<div>
								<ul>
									<li class="file_list"><i class="fa fa-file-text-o" style="margin-right: 12px;"></i>{{fileToUpload.name}}<i class="fa fa-check-circle green" style="margin-left: 60px;"></i></li>
								</ul>
							</div>
						</div>
					</form>
				</div>

			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" (click)="cancelUp(weightModal)">取消</button>
				<button type="button" class="btn btn-primary" (click)="submitData(weightModal)">确认</button>
			</div>
		</div>
	</div>
</div>
<!-- 导入弹框 结束 -->
